/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * GUIPrincipal.java
 *
 * Created on 07/04/2011, 21:46:37
 */

package net.antoniopassos.dukeclube.visao.gui;

import java.beans.PropertyVetoException;
import javax.swing.JFrame;

/**
 *
 * @author Marlon
 */
public class GUIPrincipal extends javax.swing.JFrame {

    /** Creates new form GUIPrincipal */
    public GUIPrincipal() {
        initComponents();
        this.setExtendedState(JFrame.MAXIMIZED_BOTH);
    }

    private GUISocios guiSocios;

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        desktopPane = new javax.swing.JDesktopPane();
        menuBar = new javax.swing.JMenuBar();
        menuArquivo = new javax.swing.JMenu();
        itemDeMenuImportar = new javax.swing.JMenuItem();
        itemDeMenuExportar = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        menuPreferencias = new javax.swing.JMenu();
        itemDeMenuAparencia = new javax.swing.JMenuItem();
        itemDeMenuDiretorio = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        itemDeMenuSair = new javax.swing.JMenuItem();
        menuRelatorio = new javax.swing.JMenu();
        itemDeMenuRelatorioFuncionario = new javax.swing.JMenuItem();
        itemDeMenuRelatorioSocio = new javax.swing.JMenuItem();
        menuCadastro = new javax.swing.JMenu();
        itemDeMenuCadFuncionario = new javax.swing.JMenuItem();
        itemDeMenuCadSocio = new javax.swing.JMenuItem();
        menuAjuda = new javax.swing.JMenu();
        itemDeMenuSobre = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        menuBar.setName("DukeClube"); // NOI18N

        menuArquivo.setText("Arquivo");

        itemDeMenuImportar.setText("Importar");
        menuArquivo.add(itemDeMenuImportar);

        itemDeMenuExportar.setText("Exportar");
        menuArquivo.add(itemDeMenuExportar);
        menuArquivo.add(jSeparator1);

        menuPreferencias.setText("Preferencias");

        itemDeMenuAparencia.setText("Aparencia");
        menuPreferencias.add(itemDeMenuAparencia);

        itemDeMenuDiretorio.setText("Diretórios");
        menuPreferencias.add(itemDeMenuDiretorio);

        menuArquivo.add(menuPreferencias);
        menuArquivo.add(jSeparator2);

        itemDeMenuSair.setText("sair");
        itemDeMenuSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemDeMenuSairActionPerformed(evt);
            }
        });
        menuArquivo.add(itemDeMenuSair);

        menuBar.add(menuArquivo);

        menuRelatorio.setText("Relatorio");

        itemDeMenuRelatorioFuncionario.setText("Funcionario");
        menuRelatorio.add(itemDeMenuRelatorioFuncionario);

        itemDeMenuRelatorioSocio.setText("Socio");
        menuRelatorio.add(itemDeMenuRelatorioSocio);

        menuBar.add(menuRelatorio);

        menuCadastro.setText("Cadastro");

        itemDeMenuCadFuncionario.setText("Funcinario");
        menuCadastro.add(itemDeMenuCadFuncionario);

        itemDeMenuCadSocio.setText("Socio");
        itemDeMenuCadSocio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemDeMenuCadSocioActionPerformed(evt);
            }
        });
        menuCadastro.add(itemDeMenuCadSocio);

        menuBar.add(menuCadastro);

        menuAjuda.setText("Ajuda");

        itemDeMenuSobre.setText("Sobre");
        itemDeMenuSobre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemDeMenuSobreActionPerformed(evt);
            }
        });
        menuAjuda.add(itemDeMenuSobre);

        menuBar.add(menuAjuda);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void itemDeMenuSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemDeMenuSairActionPerformed
        System.exit(0);
    }//GEN-LAST:event_itemDeMenuSairActionPerformed

    private void itemDeMenuSobreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemDeMenuSobreActionPerformed
       if ((guiSobre == null) || (!guiSobre.isVisible())) {
         guiSobre = new GUISobre();
         desktopPane.add(guiSobre);
         guiSobre.setPosicao();
         guiSobre.setVisible(true);
       }        // TODO add your handling code here:
    }//GEN-LAST:event_itemDeMenuSobreActionPerformed

    private void itemDeMenuCadSocioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemDeMenuCadSocioActionPerformed
      if ((guiSocios == null) || (!guiSocios.isVisible())) {
        guiSocios = new GUISocios();
        desktopPane.add(guiSocios);
        guiSocios.setPosicao();
        guiSocios.setVisible(true);
      }
      try {
        guiSocios.setSelected(true);
      } catch (PropertyVetoException exc) {
        StringBuffer mensagem = new StringBuffer();
        mensagem.append("Não foi possível selecionar a janela!");
        mensagem.append("\nMotivo: " + exc.getMessage());
        GUIMensagem.exibirMensagem(mensagem.toString(), "DukeClube - Sócios", true);
      }        // TODO add your handling code here:
    }//GEN-LAST:event_itemDeMenuCadSocioActionPerformed

    /**
    * @param args the command line arguments
    */
    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane desktopPane;
    private javax.swing.JMenuItem itemDeMenuAparencia;
    private javax.swing.JMenuItem itemDeMenuCadFuncionario;
    private javax.swing.JMenuItem itemDeMenuCadSocio;
    private javax.swing.JMenuItem itemDeMenuDiretorio;
    private javax.swing.JMenuItem itemDeMenuExportar;
    private javax.swing.JMenuItem itemDeMenuImportar;
    private javax.swing.JMenuItem itemDeMenuRelatorioFuncionario;
    private javax.swing.JMenuItem itemDeMenuRelatorioSocio;
    private javax.swing.JMenuItem itemDeMenuSair;
    private javax.swing.JMenuItem itemDeMenuSobre;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JMenu menuAjuda;
    private javax.swing.JMenu menuArquivo;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenu menuCadastro;
    private javax.swing.JMenu menuPreferencias;
    private javax.swing.JMenu menuRelatorio;
    // End of variables declaration//GEN-END:variables

    private GUISobre guiSobre;

}
